use serde::{Deserialize, Serialize};
use validator::Validate;

#[derive(Deserialize, Serialize, Debug, sqlx::FromRow)]
pub struct Test {
    pub id: Option<i16>,
    pub name: Option<String>,
    pub age: Option<String>,
}

#[derive(Deserialize, Serialize, Debug, sqlx::FromRow, Validate)]
pub struct TestCheck {
    pub id: Option<i16>,
    pub name: Option<String>,
    #[validate(range(min = 1, max = 100, message = "Age should be between 1 and 100"))]
    pub age: Option<u8>,
    #[validate(length(min = 1, max = 100, message = "Name should be between 1 and 100 characters"))]
    #[serde(rename = "testName")]
    pub test_name: String,
}
